package com.syp.auth.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CookieValue;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.syp.auth.export.common.GeneralUserVo;
import com.syp.auth.export.common.GorgeousParameters;
import com.syp.auth.export.resource.AuthorizeResourceI;
import com.syp.auth.export.util.CurrentUserHolder;

/**
 * druid datasource manager Action
 * 
 * @author syp
 * 
 */
@Controller
@RequestMapping("/layout")
public class LayoutController {

	@Autowired
	private AuthorizeResourceI authorizeResource;

	@RequestMapping("/center")
	public String center() {
		return "layout/center";
	}

	@RequestMapping("/east")
	public String east() {
		return "layout/east";
	}

	@RequestMapping("/north")
	public ModelAndView north(@CookieValue(GorgeousParameters.AUTH_COOKIE_NAME) String sid) {
		ModelAndView mv = new ModelAndView("layout/north");
		GeneralUserVo guser = CurrentUserHolder.get();
		if (guser == null) {
			guser = this.authorizeResource.cuser(sid);
		}
		mv.addObject("guser", guser);
		return mv;
	}

	@RequestMapping("/south")
	public String south() {
		return "layout/south";
	}

	@RequestMapping("/west")
	public String west() {
		return "layout/west";
	}

	@RequestMapping("/door")
	public String door() {
		return "layout/door";
	}

	@RequestMapping("/portal")
	public String portal() {
		return "layout/portal";
	}

	@RequestMapping("/portal/notice")
	public String portal_notice() {
		return "layout/portal/notice";
	}

	@RequestMapping("/portal/repair")
	public String portal_repair() {
		return "layout/portal/repair";
	}

	@RequestMapping("/portal/task")
	public String portal_task() {
		return "layout/portal/task";
	}

	@RequestMapping("/portal/warn")
	public String portal_warn() {
		return "layout/portal/warn";
	}
}
